package com.zhao.trace.controller;

import com.zhao.trace.entity.User;
import com.zhao.trace.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/finduser")
public class UserController {
    @Autowired
    UserService userService;

    @GetMapping("get/{username}")
    public User findByUsername(@PathVariable String username){
        System.out.print("1111111");
        return userService.findByUsername(username);
    }

    @GetMapping("get")
    public List<User> findAll(){
        System.out.print("find all");
        return userService.findAll();
    }

}
